import React, { Component } from 'react';
import './App.css';
import { DatePicker, Button } from 'element-react';
import 'element-theme-default';
// 必须先引入react-dom后引入react-router-dom
import ReactDom from 'react-dom';
import {Swtich, Route, Router, HashHistory, Link} from 'react-router-dom';
// 引入组件


class App extends Component {
  constructor(props) {
    super(props)
    this.state = {}
  }
  componentWillMount () {
    console.log(this.state);
  }
  componentDidMount () {
    console.log(this.state);
  }
  componentWillReceiveProps (nextProps) {
    console.log(this.state);
  }
  shouldComponentUpdate (nextProps,nextState) {
    console.log(this.state);
    return true;
  }
  componentWillUpdate (nextProps,nextState) {
    console.log(this.state);
  }
  componentDidUpdate (prevProps,prevState) {
    console.log(this.state);
  }
  render() {
    const {value1, value2} = this.state;
    return (
      <div className="source">
        <div>
          <ul>
              <li><Link to='/'>首页</Link></li>
              <li><Link to='/about'>关于</Link></li>
              <li><Link to='/topics'>主题列表</Link></li>
          </ul>
          <hr/>
          <Route exact path="/" component={Home} />
          <Route path="/about" component={About} />
          <Route path="/topics" component={Topics} />
        </div>
      </div>
    );
  }
}

export default App;
